/**
 * 版权所有（c）2021. 上海海鼎信息工程股份有限公司，保留所有权利
 */
package com.lovely602.design.structure.proxy.dynamic;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * 动态代理控制器
 *
 * @author lizhixing
 */
public class ProxyHandler implements InvocationHandler {

  private Object object;

  public ProxyHandler(Object object) {
    this.object = object;
  }

  @Override
  public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
    System.out.println("Before invoke " + method.getName());
    method.invoke(object, args);
    System.out.println("After invoke " + method.getName());
    return null;
  }
}
